home *** CD-ROM | disk | FTP | other *** search
- <?php
- /*
- ** $Id: mhwainit.php,v 1.3 2005/01/05 22:22:50 hmailserver Exp $
- **
- ** hMailServer - Web interface
- **
- ** File formatted using TAB size 4
- **
- ** Get hMailserver at http://www.hmailserver.com
- **
- ** Author: Steen Rab°l <srabol@mail.tele.dk>
- ** Copyright (c) 2004, Steen Rab°l <srabol@mail.tele.dk>
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** You may not change or alter any portion of this comment or credits
- ** of supporting developers from this source code or any supporting
- ** source code which is considered copyrighted (c) material of the
- ** original comment or credit authors.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- **
- */
-
- $hmail_config['langstrings'] = array();
-
- // make sure path's only have forward slashes
- $hmail_config['rootpath'] = str_replace("\\","/",$hmail_config['rootpath']);
- $hmail_config['includepath'] = str_replace("\\","/",$hmail_config['includepath']);
- $hmail_config['temppath'] = str_replace("\\","/",$hmail_config['temppath']);
- $hmail_config['pluginpath'] = str_replace("\\","/",$hmail_config['pluginpath']);
-
- require_once($hmail_config['includepath'] . "functions.php");
-
- // Load language string
- $langfile = hmailGetVar("language" . ".lang",$hmail_config['defaultlanguage'].".lang");
- $hmail_config['langfile'] = $langfile;
- hmailLoadLanguage($langfile);
- $hmail_config['themepath'] = $hmail_config['rooturl'] . "theme/" . hmailGetVar("theme",$hmail_config['defaulttheme']) . "/";
-
- require_once($hmail_config['includepath'] . "smarty/Smarty.class.php");
-
- class hmailSmarty extends Smarty
- {
- function hmailSmarty($hmail_config)
- {
- //global $hmail_config;
- parent::Smarty();
-
- // Setup Smarty
- $this->template_dir = $hmail_config['rootpath'] . 'theme/' . hmailGetVar("defaulttheme",$hmail_config['defaulttheme']);
- $this->compile_dir = $hmail_config['rootpath'] . 'template_c/';
- $this->assign("hmail_config",$hmail_config);
- $this->register_block("translate","hmailTranslate");
- $this->autoload_filters = array('output' => array('trimwhitespace'));
- }
- }
-
- $hmailSmarty = new hmailSmarty($hmail_config);
- session_start();
-
- // Connect to hMailServer
- $obBaseApp = new COM("hMailServer.Application");
- set_error_handler("ConnectError");
- $obBaseApp->Connect();
- restore_error_handler();
-
- // error handler function
- function ConnectError($errno, $errstr, $errfile, $errline)
- {
- $descstart = strpos($errstr, "Description");
- $descstart += strlen("Description");
-
- $cleanerrormsg = substr($errstr, $descstart);
- echo "<br><br>ERROR: $cleanerrormsg";
- }
- ?>